|
|
|
|
|
|
|
Chapter 8
Bitmap Animation |
|
|
|
|
|
|
|
|
This chapter describes ways you can add animation to your Visual Basic programs. It begins with a brief explanation of what animation is and how it works. It then describes some of the Visual Basic and API tools you can use to add animation to programs. |
|
|
|
|
|
|
|
|
As is often the case in programming, some techniques are relatively slow and simple while others are faster and more complex. Using the examples in this chapter and the summary at the end, you can select the right animation method for your application. |
|
|
|
|
|
|
|
|
Animation is a process in which you rapidly present a series of images, called frames, to create the illusion of motion. If you present the images quickly enough, and if the changes from one image to the next are not too large, an observer perceives the series as a single image that is changing over time. |
|
|
|
|
|
|
|
|
To give the appearance of smooth motion, you need to display around 16 to 20 frames per second. If you display the images more slowly, the movement appears jerky. Standard motion pictures present 24 frames per second, though that speed is not always possible on a computer. |
|
|
|
|
|
|
|
|
In the United States, television signals present 30 images per second. These television images are displayed in two parts. First the odd-numbered rows of pixels in the image are displayed, and then even-numbered rows are displayed. This interlaced scan makes the changes between frames occur in two smaller stages, so it seems to a television viewer that twice as many images are being presented. That makes motion in the image appear even smoother. |
|
|
|
|
|
|
|
|
Many computer monitors use progressive scan rather than interlaced scan. Here the rows of pixels on the screen are updated in order rather than in alternating odd- and even-numbered rows. To make the image look smooth, progressive scan monitors usually |
|
|
|
|
|